<template>
  <navigator
    class=""
    target=""
    :url="`/pages/search/particulars/index?id=${data.id}`"
    hover-class="navigator-hover"
    open-type="navigate"
  >
    <view class="card">
      <view class="image-section">
        <image class="profile-img" :src="data.avatar" />
      </view>
      <view class="details-section">
        <view class="name-section">
          <view class="name-image">
            <text class="name">{{ data.nickname === '' ? '暂无数据' : data.nickname }}</text>
            <image
              class="gender-icon"
              :src="data.gender === '男' ? '/static/images/boy.png' : '/static/images/girl.png'"
            />
          </view>
          <view class="name-desc">{{ data.marriage_timing }}</view>
        </view>
        <view class="info-desc">
          <view class="info-section">
            <text class="info">{{ data.age === '' ? '暂无数据' : data.age }}岁</text>
            <text class="info">{{ data.height === '' ? '暂无数据' : data.height }}cm</text>
            <text class="info">{{ data.education === '' ? '暂无数据' : data.education }}</text>
            <text class="info">{{
              data.monthly_income === '' ? '暂无数据' : data.monthly_income
            }}</text>
          </view>
          <view class="location-section">
            <image src="../../../static/images/address.png" class="location-icon" />
            <text class="location">{{
              data.household_region === '' ? '暂无数据' : data.household_region
            }}</text>
          </view>
        </view>

        <text class="description">{{
          data.self_introduction === '' ? '暂无数据' : data.self_introduction
        }}</text>
      </view>
    </view>
  </navigator>
</template>

<script setup lang="ts">
import type { UserItem } from '@/types/index/home'

defineProps<{ data: UserItem }>()
</script>

<style lang="scss" scoped>
.card {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  overflow: hidden;
  margin: 20rpx;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.image-section {
  position: relative;
  width: 100%;
  height: 800rpx;
}

.profile-image {
  width: 100%;
  height: 100%;
}

.verified-badge {
  position: absolute;
  top: 20rpx;
  left: 20rpx;
  background-color: red;
  color: white;
  padding: 4rpx 10rpx;
  font-size: 24rpx;
  border-radius: 3px;
  z-index: 2;
}

.icon {
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 10rpx;
  margin-bottom: 10rpx;
  border-radius: 50%;
  font-size: 28rpx;
  text-align: center;
  width: 48rpx;
  height: 48rpx;
}

.details-section {
  padding: 16px;
  .name-image {
    display: flex;
    .name {
      font-size: 20px;
      margin-right: 8px;
    }
  }
  .name-section {
    display: flex;
    justify-content: space-between;
    image {
      margin-top: 5px;
      width: 20px;
      height: 20px;
    }
  }

  .name-desc {
    color: #999999;
  }
}

.info-desc {
  display: flex;
  justify-content: space-between;
}

.gender-icon {
  font-size: 18px;
}

.info-section {
  color: #666666;
  display: flex;
  justify-content: space-around;
  margin: 10px 0;
}

.info {
  background-color: #f0f0f0;
  padding: 2px 6 px;
  border-radius: 15px;
  font-size: 14px;
  margin-right: 5px;
}

.location-section {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
}

.location-icon {
  width: 16px;
  height: 16px;
  margin-right: 4px;
}

.location {
  color: #666;
}

.description {
  text-align: center;
  color: #666;
  font-size: 14px;
}
</style>
